package com.goktech.mapper;

import com.goktech.entity.type;
import com.goktech.util.SqlSessionUtil;
import org.apache.ibatis.session.SqlSession;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.io.IOException;

/**
 * @ClassName testTypeMapper
 * @Description TODO
 * @Author 邱华英
 * @Date 2022/10/3 21:09
 * @Version 1.0
 */

public class testTypeMapper {
    SqlSession session = null;
    TypeMapper typeMapper = null;

    @Before
    public void before() throws IOException {
        session = SqlSessionUtil.getSqlSession();
        typeMapper = session.getMapper(TypeMapper.class);
    }

    @After
    public void after(){
        session.close();
    }

    @Test
    public void testInsertType(){
        type t = new type();
        t.setType("娱乐");
        System.out.println(typeMapper.insertType(t));
    }

    @Test
    public void testUpdateType(){
        type t = new type();
        t.setId(11);
        t.setType("娱乐1");
        System.out.println(typeMapper.updateType(t));
    }

    @Test
    public void testdeleteType(){
        type t = new type();
        t.setId(11);
        t.setType("娱乐1");
        System.out.println(typeMapper.deleteType(t));
    }

    @Test
    public void testfindType(){
        type t = new type();
        t.setId(12);
        System.out.println(typeMapper.findByType(t));
    }

    @Test
    public void testfindByAll(){
        System.out.println(typeMapper.findByAll());
    }
}
